/*
 * RSParam.cpp
 *
 *  Created on: 2010/03/16
 *      Author: alexandre
 */

#include "RSParam.h"
#include "RSAccessor.h"

namespace Realsphere {

    RSParam::RSParam ( Realsphere::RSAccessor* rAccessor, RSValueType rDataType, const QString& rName, const QString& rScopeId, RSInputSemanticType rSemantic ) :
            RSElement ( RS_PARAM_TAG )
    {
        mDataType = rDataType;
        SetName ( rName, false );
        SetScopeId ( rScopeId, false );
        SetSemantic ( rSemantic, false );

        if ( rAccessor != NULL )
            rAccessor->AddParam ( this );
    }

    RSParam::~RSParam ()
    {
    }

    QString RSParam::ScopeId () const {
        return mScopeId;
    }

    RSValueType RSParam::DataType() const {
        return mDataType;
    }

    RSInputSemanticType RSParam::Semantic() const {
        return mSemantic;
    }

    bool RSParam::IsRootElement() const {
        return false;
    }

    void RSParam::SetScopeId ( const QString& rScopeId, bool rEmit ) {
        mScopeId = rScopeId;
        if ( rEmit )
            emit ScopeIdChanged ( mScopeId );
    }

    void RSParam::SetSemantic ( RSInputSemanticType rSemantic, bool rEmit ) {
        mSemantic = rSemantic;
        if ( rEmit )
            emit SemanticChanged ( mSemantic );
    }

    RSError RSParam::BeforeAddChildElement ( RSElement* rChild ) {
        return RS_INVALID_CHILD;
    }
}
